<?php 
class GameLogic {
	//与游戏算法相关的方法
	//基础生产算法
	static public function getBaseProduce($basenum,$percent,$grade){
		return round($basenum * $grade * pow(1+$percent/100,$grade),0);
	}
	//带科技加成的生产算法
	static public function getProduce($basenum,$percent,$grade,$tech,$legion_tech){
		return round(getBaseProduce($basenum,$percent,$grade) * (1+$tech*0.01) * (1+$legion_tech*0.01),0);
	}
	//建筑所需时间
	//building从1级开始
	static public function getBuildTime($basenum,$percent,$grade){
		return round($basenum * $grade * pow(1+$percent/100,$grade),0);
	}
	//建筑所需资源
	static public function getBuildRes($basenum,$percent,$grade){
		return round($basenum * $grade * pow(1+$percent/100,$grade),0);
	}
	//研究所需时间
	//research从0级开始
	static public function getResearchTime($basenum,$percent,$grade){
		//$grade+=1;
		return round($basenum * $grade * pow(1+$percent/100,$grade),0);
	}
	//研究所需资源
	static public function getResearchRes($basenum,$percent,$grade){
		$grade+=1;
		return round($basenum * $grade * pow(1+$percent/100,$grade),0);
	}
	
	/**
	 * 
	 * 调情成功率计算
	 * @param int $clubHotness 夜店属性
	 * @param int $quality 男朋友品质
	 * @param int $itemRate 道具加成
	 */
	static public function flirtResult($clubHotness, $quality, $itemRate) {
		$rate = 30; //初始成功率
		$rate += $itemRate;
		return Common::luckExt($rate); 
	}
}
?>